package main

import (
	"fmt"
	"math"
)

type geometry interface {
	area() float64
	perim() float64
}

type rect2 struct {
	width,height float64
}

type circle struct {
	radius float64
}

func (r rect2) area() float64  {
	return r.width*r.height
}

func (r rect2) perim() float64  {
	return 2*(r.width + r.height)
}

func (c circle) area() float64  {
	return math.Pi * c.radius*c.radius
}

func (c circle) perim() float64  {
	return 2*math.Pi * c.radius
}

func measure(g geometry)  {
	fmt.Println(g)
	fmt.Println(g.area())
	fmt.Println(g.perim())
}

func testInterface()  {
	r:= rect2{width:1.2,height:1.5}
	c:= circle{radius:2.3}
	measure(r)
	measure(c)
}